#ifndef UNIT_H
#define UNIT_H

#include "Utils.h"
#include "game/Updatable.h"
#include "renderer/GameRenderer.h"
#include "game/Map.h"

namespace VectorTD
{
	class Unit : public Updatable
	{
	public:
		Unit(GameRenderer::GameMesh* p_mesh, float p_baseSpeed, unsigned int p_baseHp, float p_rotationSpeed, float p_scale, Map* p_map);
		bool Update(double p_deltaMs);
		void Spawn(glm::vec2 p_startPosition);
		glm::vec2 Position();

		// Display
		GameRenderer::GameMesh* m_mesh;
		glm::mat4 m_modelMat;
		glm::mat4 m_transMat;
		glm::mat4 m_rotMat;
		glm::mat4 m_scaleMat;
		glm::vec4 m_unitColor;

		// Unit caracteristic
		const float			m_baseSpeed; // 0.0f <= value <= 10.0f : 0 = can't move, 10 = in 1 second can cross all the map, 1 = in one second can cross 10% of the size of the map
		const unsigned int	m_baseHp; // 0.0f < value < UINT_MAX (2^16-1 = 65535)
		const float			m_rotationSpeed; // 0.0f <= value <= 360.0f : Number of degre per second to rotate.

	private:
		Map* m_map;
		int m_nextPathCell;
	};
}

#endif